<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>CSS Test: CSS Tables: Margin Collapsing</title>
        <link rel="author" title="Ian Hickson" href="mailto:ian@hixie.ch" />
        <link rel="alternate" href="http://www.hixie.ch/tests/adhoc/css/box/table/016.xml" type="application/xhtml+xml" />
        <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins" />
        <style type="text/css">* { margin: 0; padding: 0 }
            div#wrapper
            {
                border: blue solid medium;
                height: 188px;
                /*
                20px (margin-top) + 1px + 20px (content) + 1px + max(20px, 20px) 1st div table
                + 1px + 20px (content) + 1px + max(20px, 20px)  2nd div table
                + 1px + 20px (content) + 1px + max(20px, 20px)  1st p table
                + 1px + 20px (content) + 1px + 20px 2nd p table
                --------------------------------------------------------
                188px
                */
            }
            
            .table
            {
                border: 1px solid silver;
                border-spacing: 0;
                display: table;
                font: 20px/20px Ahem;
                height: 1em;
                margin: 1em;
            }
            
            div.table-row
            {
                display: table-row;
            }
            
            div.cell
            {
                display: table-cell;
            }
        </style>
    </head>
    <body>
        <p>There should be four black bars below that do not overflow the blue box.</p>
        <div id="wrapper">
            <div class="table">
                <div class="table-row">
                    <div class="cell">Test</div>
                </div>
            </div>
            <div class="table">
                <div class="table-row">
                    <div class="cell">Test</div>
                </div>
            </div>
            <p class="table">Test</p>
            <p class="table">Test</p>
        </div>
        <p>This test has passed if the black bars are evenly distributed in the blue box. The gap between the blue border at the top and the first black bar should be equal to the gap between the 4th bar and the blue border at the bottom.</p>
    </body>
</html>
